// 子模块moduleA路径：store/modules/moduleA.js
export default {
	// namespaced:true,
	state: {
		address:JSON.parse(uni.getStorageSync('address')||"{}"),
		token:uni.getStorageSync('token')||'',
		userInfo:JSON.parse(uni.getStorageSync('userinfo')||"{}"),
		redirectInfo:null//{openType 跳转类型 ，from  希望跳转页面的路径}
	},
	getters: {
        fullAdress(state){
        	if(!state.address.provinceName)return ''
        	return `${state.address.provinceName}${state.address.cityName}${state.address.countyName}${state.address.detailInfo}`
        },
	},
	mutations: {
		updateRedirectInfo(state,obj){
			state.redirectInfo = obj
		},
		saveTolocationU(state){
			uni.setStorageSync('userinfo',JSON.stringify(state.userInfo))
		},
		updateUserInfo(state,userinfo){
			state.userInfo = userinfo
		    this.commit('saveTolocationU')
		},
		saveTolocation(state){
			uni.setStorageSync('address',JSON.stringify(state.address))
		},
        updateAddress(state,address){
			state.address = address
			this.commit('saveTolocation')
		},
		updateToken(state,token){
			state.token = token
			uni.setStorageSync('token',JSON.stringify(state.token))
		},
	},
	actions: {

	}
}
